import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue'),
      hidden: true
    },

    {
      path: '/',
      redirect: '/dashboard',
      name: 'layout',
      component: Layout,
      children:[
        {
          path: '/dashboard',
          name: 'dashboard',
          component: () => import('@/views/dashboard/index.vue'),
          meta: {
            title: '工作台',
            icon: '#icon-gongzuotai'
          }
        },
        {
          path:'/park',
          name:'park',
          redirect:'/building',
          meta:{
            title:'园区管理',
            icon:'#icon-renyuanguanli'
          },
          children:[
            {
              path:'/building',
              name:'building',
              component:()=>import('@/views/park/building.vue'),
              meta:{
                title:'楼宇管理'
              }
            },
            {
              path:'/enterprise',
              name:'enterprise',
              component:()=>import('@/views/park/enterprise.vue'),
              meta:{
                title:'企业管理'
              }
            }
          ]
        },
          {
          path:'/car',
          name:'Car',
          redirect:'/area',
          meta:{
            title:'行车管理',
            icon:'#icon-qichepeijian'
          },
          children:[
            {
              path:'/area',
              name:'Area',
              component:()=>import('@/views/car/car-area.vue'),
              meta:{
                title:'区域管理'
              }
            },
            {
              path:'/monthcard',
              name:'MonthCard',
              component:()=>import('@/views/car/monthCard.vue'),
              meta:{
                title:'月卡管理'
              }
            },
            {
              path:'/pay',
              name:'pay',
              component:()=>import('@/views/car/car-pay.vue'),
              meta:{
                title:'停车缴费管理'
              }
            },
            {
              path:'/billing',
              name:'billing',
              component:()=>import('@/views/car/czr-billing.vue'),
              meta:{
                title:'计费规则管理'
              }
            }
          ]
        },
        {
          path: '/cost',
          name: 'cost',
          component: () => import('@/views/propety/index.vue'),
          meta: {
            title: '物业费管理',
            icon: '#icon-dangan',
        },
      },
          {
          path:'/rod',
          name:'rod',
          redirect:'/manage',
          meta:{
            title:'一体杆管理',
            icon:'#icon-signal-full'
          },
          children:[
            {
              path:'/manage',
              name:'manage',
              component:()=>import('@/views/rod/rod-manage.vue'),
              meta:{
                title:'一体杆管理'
              }
            },
            {
              path: '/manage',
              name: 'manage',
              component: () => import('@/views/rod/rod-manage.vue'),
              hidden: true
            },
            {
              path: '/warnList',
              name: 'warnList',
              component: () => import('@/views/rod/warnList.vue'),
              meta: {
                title: '告警记录'
              }
            },
          ]
        },
          {
          path:'/system',
          name:'system',
          redirect:'/employee',
          meta:{
            title:'系统管理',
            icon:'#icon-xitongguanli'
          },
          children:[
            {
              path:'/employee',
              name:'employee',
              component:()=>import('@/views/system/employee.vue'),
              meta:{
                title:'员工管理'
              }
            },
            {
              path:'/system/permission',
              name:'permission',
              component:()=>import('@/views/system/system-permission.vue'),
              meta:{
                title:'角色管理'
              }
            }
          ]
        }
      ]
    },
    {
      path: '/system/role/add/:id?',
      name: 'roleadd',
      component: () => import('@/views/system/role-add.vue'),
      hidden: true
    },
    {
      path: '/warn',
      name: 'warn',
      hidden: true,
      component: () => import('../views/rod/warn.vue'),
      meta: {
        title: '详情'
      }
    },
    {
      path: '/404',
      name: '404',
      component: () => import('@/layout/404.vue'),
      hidden: true
    },
    {
      path:'/404',
      name:'404',
      component:()=>import('@/layout/404.vue'),
      hidden:true
    },
    { path: '/:catchAll(.*)', redirect:'/404', hidden: true },
    {
      path:'/addenterprise',
      name:'addenterprise',
      component:()=>import('@/views/park/components/addenterprise.vue'),
      meta:{
        title:'添加企业',
      },
    },
    {
      path:'/bjenterprise',
      name:'bjenterprise',
      component:()=>import('@/views/park/components/bjenterprise.vue'),
      meta:{
        title:'编辑企业'
      }
    },
    {
      path:'/ckenterprise',
      name:'ckenterprise',
      component:()=>import('@/views/park/components/ckenterprise.vue'),
      meta:{
        title:'查看企业'
      }
    }
  ]
})

export default router
